#include <iostream>
#include <string>
class A{
    public:
        friend std::ostream& operator<<(std::ostream& os, const A& a);
        A() {}
        explicit A(int i) : _i(i) {}
        virtual ~A(){}
        
    private:
        int _i = 10;

};

//重载<<
std::ostream& operator<<(std::ostream& os, const A& a) {
            os << a._i;
            return os;
        }
//编写可变参数的函数模板
template<typename T>
std::ostream& print(std::ostream &os, const T& t)
{
    return os << t << std::endl;
}

template<typename T, typename ... Args>
std::ostream &print(std::ostream &os, const T&t, const Args&... rest)
{
    os << t << ", ";
    return print(os, rest...);
}

int main()
{
    int i = 12;
    int j = 23;
    std::string s = "sdaa";
    // A a(static_cast<int>(j));
    A a(23);
    print(std::cout, i, s, a, 42);

    return 0;
}